<template>
    <div class="rela">
        <div ref="backIcon" class="back absolute shou" @click="back()"></div>
        <div style="width:1200px;margin: 0 auto;">
            <slot></slot>
        </div>
    </div>
</template>

<script>
export default {
    components: {},
    props: {
      type:{},
      closeState:{}
    },
    data() {
        return {};
    },
    watch: {},
    methods: {
        back() {
          console.log(this.closeState,'this.closeState')
          if (this.type){
            if(this.type==3){
              this.$router.go(-1)
            }else {
              if (this.closeState){
                this.$router.go(-1)
                return
              }
              let paperTypeText = {
                1: '考核',
                3: '练习',
                6: '作业'
              }
              this.$confirm(
                `${paperTypeText[this.type]}已开始，退出后会继续计时，倒计时结束将自动提交试卷，是否继续退出?`,
                '提示',
                {
                  confirmButtonText: '退出',
                  cancelButtonText: '取消',
                  type: 'warning'
                }
              ).then(async() => {
                this.$router.go(-1)
              })
            }
          }else {
            this.$router.go(-1);
          }
        },
    },
    created() { },
    mounted() { },
};
</script>
<style scoped lang='scss'>
.back {
    background-size: 48px 48px;
    background-image: url("../assets/images/back.png");
    top: 52px;
    left: 28px;
    width: 48px;
    height: 48px;
}

.back:hover {
    background-size: 48px 48px;
    background-image: url("../assets/images/backactive.png");
}
</style>
